package cn.iocoder.yudao.module.system.dal.mysql.officeinfo;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.officeinfo.vo.SeatinfoPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.officeinfo.SeatinfoDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 办公室座位信息 Mapper
 *
 * @author Warren365
 */
@Mapper
public interface SeatinfoMapper extends BaseMapperX<SeatinfoDO> {

    default List<SeatinfoDO> selectListByOfficeId(Long officeId) {
        return selectList(SeatinfoDO::getOfficeId, officeId);
    }

    default int deleteByOfficeId(Long officeId) {
        return delete(SeatinfoDO::getOfficeId, officeId);
    }

    default PageResult<SeatinfoDO> selectPage(SeatinfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SeatinfoDO>()
                .eqIfPresent(SeatinfoDO::getOfficeId, reqVO.getOfficeId())
                .eqIfPresent(SeatinfoDO::getSeatNum, reqVO.getSeatNum())
                .eqIfPresent(SeatinfoDO::getSeatStatus, reqVO.getSeatStatus())
                .likeIfPresent(SeatinfoDO::getSeatName, reqVO.getSeatName())
                .eqIfPresent(SeatinfoDO::getSeatSite, reqVO.getSeatSite())
                .betweenIfPresent(SeatinfoDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(SeatinfoDO::getSeatRegion, reqVO.getSeatRegion())
                .orderByAsc(SeatinfoDO::getUpdateTime));
    }
}